<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="c.tld" prefix="c" %>
<%@ taglib uri="sql.tld" prefix="sql" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>

	<!-- count registros -->
	
	<c:choose>
		<c:when test="${param.comboboxEquipe == 'todas' }">
			<sql:query var="queryEstoqueCenop" scope="page">
				select PEC.protocolo as protocolo,PEC.cliente as cliente,FE.nomeFuncionarioEquipe as responsavel,E.descricaoEquipe as equipe,TP.nomeTipoProcesso as tipoProcesso
				from protocolosestoquecenop PEC
				inner join equipe E on E.idEquipe = PEC.idEquipe
				inner join funcionarioequipe FE on FE.idFuncionarioEquipe = PEC.idFuncionarioEquipe
				inner join tipoprocesso TP on TP.idTipoProcesso = PEC.idTipoProcesso
				where SUBSTR(PEC.dataRegistro,1,8) = ?
				order by E.descricaoEquipe,FE.nomeFuncionarioEquipe	
			<sql:param><c:out value="${param.textFieldDataColeta}"/></sql:param>		
			</sql:query>
			<c:set var="countQueryEstoqueCenop" value="${queryEstoqueCenop.rowCount}" scope="page"/>		
		</c:when>
		<c:otherwise>
			<sql:query var="queryEstoqueCenop" scope="page">
				select PEC.protocolo as protocolo,PEC.cliente as cliente,FE.nomeFuncionarioEquipe as responsavel,E.descricaoEquipe as equipe,TP.nomeTipoProcesso as tipoProcesso
				from protocolosestoquecenop PEC
				inner join equipe E on E.idEquipe = PEC.idEquipe
				inner join funcionarioequipe FE on FE.idFuncionarioEquipe = PEC.idFuncionarioEquipe
				inner join tipoprocesso TP on TP.idTipoProcesso = PEC.idTipoProcesso
				where SUBSTR(PEC.dataRegistro,1,8) = ? and E.idEquipe = ?
				order by E.descricaoEquipe,FE.nomeFuncionarioEquipe
			<sql:param><c:out value="${param.textFieldDataColeta}"/></sql:param>
			<sql:param><c:out value="${param.idEquipe}"/></sql:param>
			</sql:query>
			<c:set var="countQueryEstoqueCenop" value="${queryEstoqueCenop.rowCount}" scope="page"/>			
		</c:otherwise>	
	</c:choose>
	
	<!-- verifica se existe registros e redireciona -->
	
	<c:choose>
		<c:when test="${param.comboboxEquipe eq 'todas' and countQueryEstoqueCenop > '0'}">
					<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>				
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EVD1' and countQueryEstoqueCenop > '0'}">
			
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
			
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EVD2' and countQueryEstoqueCenop > '0'}">
			
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
				
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EVD3' and countQueryEstoqueCenop > '0'}">
			
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
			
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EVD4' and countQueryEstoqueCenop > '0'}">
			
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
				
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EVD5' and countQueryEstoqueCenop > '0'}">
			
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
				
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EVD6' and countQueryEstoqueCenop > '0'}">
			
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
					
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EVD7' and countQueryEstoqueCenop > '0'}">
			
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
					
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EVD8' and countQueryEstoqueCenop > '0'}">
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
			
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EVD9' and countQueryEstoqueCenop > '0'}">
			
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
				
		</c:when>	
		<c:when test="${param.comboboxEquipe eq 'EVD10' and countQueryEstoqueCenop > '0'}">
			
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
					
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EVD11' and countQueryEstoqueCenop > '0'}">
			
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
				
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EVD12' and countQueryEstoqueCenop > '0'}">
			
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
					
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EVD13' and countQueryEstoqueCenop > '0'}">
			
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
				
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EVD14' and countQueryEstoqueCenop > '0'}">
			
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
					
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EVD15' and countQueryEstoqueCenop > '0'}">
			
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
					
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EVD16' and countQueryEstoqueCenop > '0'}">
			
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
				
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'TRIAGEM' and countQueryEstoqueCenop > '0'}">
			
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
					
		</c:when>
		<!-- 
		<c:when test="${param.comboboxEquipe eq 'controle' and countQueryEstoqueCenop > '0'}">
			
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
				
		</c:when>
		-->
		<c:when test="${param.comboboxEquipe eq 'liberadas' and countQueryEstoqueCenop > '0'}">
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
			
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EVD17' and countQueryEstoqueCenop > '0'}">
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
			
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EVD18' and countQueryEstoqueCenop > '0'}">
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
			
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EVD19' and countQueryEstoqueCenop > '0'}">
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
			
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EVD20' and countQueryEstoqueCenop > '0'}">
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
			
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EVD21' and countQueryEstoqueCenop > '0'}">
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
			
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EVD22' and countQueryEstoqueCenop > '0'}">
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
			
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EMC1' and countQueryEstoqueCenop > '0'}">
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
			
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EMC2' and countQueryEstoqueCenop > '0'}">
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
			
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EMC3' and countQueryEstoqueCenop > '0'}">
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
			
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EMC4' and countQueryEstoqueCenop > '0'}">
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
			
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EMC5' and countQueryEstoqueCenop > '0'}">
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
			
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EMC6' and countQueryEstoqueCenop > '0'}">
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
			
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EMC7' and countQueryEstoqueCenop > '0'}">
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
			
		</c:when>
		<c:when test="${param.comboboxEquipe eq 'EMC8' and countQueryEstoqueCenop > '0'}">
				<c:redirect url="Controller.jsp">
					<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>		
					<c:param name="comboboxEquipe" value="${param.comboboxEquipe}"/>
					<c:param name="dataColeta" value="${param.dataColeta}"/>
					<c:param name="idEquipe" value="${param.idEquipe}"/>
					<c:param name="redirectvConsultaResponsavel" value="redirect"/>		
				</c:redirect>
			
		</c:when>
		<c:otherwise>
			<c:redirect url="Controller.jsp">
				<c:param name="redirectMensagem" value="redirect"/>
				<c:param name="mensagem" value="sem dados para a data informada"/>
				<c:param name="textFieldDataColeta" value="${param.textFieldDataColeta}"/>
			</c:redirect>	
		</c:otherwise>
	</c:choose>		
</body>
</html>